<template>
  <div class="view-tools">
    <div class="view-tools__container">
      <el-button :disabled="!canUndo" @click="HistorySnapshot.undo">
        撤销
      </el-button>
      <el-button :disabled="!canRedo" @click="HistorySnapshot.redo">
        恢复
      </el-button>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { HistorySnapshot } from '@/utils/historySnapshot'
import { useSnapshotStore } from '@/store/3d/snapshot'

const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
</script>

<style lang="scss" scoped>
.view-tools {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  &__container {
    position: relative;
    pointer-events: auto;
  }
}
</style>
